import request from '@/utils/request'

// 1.获取组织架构数据
export const getDepartments = () => {
  return request({
    url: '/company/department'
  })
}

// 2.删除
export const delDepartments = id => {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

// 3.新增部门
export const addDepartments = data => {
  return request({
    url: `/company/department`,
    method: 'post',
    data
  })
}

//4.(编辑用)获取某个部门信息
export const getEachDept = id => {
  return request({
    url: `/company/department/${id}`
  })
}

// 5.编辑部门资料后：保存资料
export const saveEachDept = data => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
